package com.api.service.impl;

import com.api.model.entity.BaseData;
import com.api.model.request.BaseDataListRequest;
import com.api.model.request.CommodityListRequest;
import com.api.model.response.NullResponse;
import com.api.common.reqres.Request;
import com.api.common.reqres.Response;
import com.api.component.BaseDataComponent;
import com.api.component.RequestComponent;
import com.api.component.ResponseComponent;
import com.api.mapper.BaseDataMapper;
import com.api.mapper.CommodityMapper;
import com.api.service.BaseDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author cfp
 * @since 2019-09-03
 */
@Service
public class BaseDataServiceImpl extends ServiceImpl<BaseDataMapper, BaseData> implements BaseDataService {
	@Autowired
	private ResponseComponent responseComponent;
	@Autowired
	private BaseDataComponent baseDataComponent;

	@Override
	public Response<NullResponse> baseDataList(Request<BaseDataListRequest> request) {
		// TODO Auto-generated method stub
		BaseDataListRequest baseDataListRequest = request.getBody();
		List<BaseData> baseDataList = baseDataComponent.getBaseDataByType(baseDataListRequest.getType());
		return responseComponent.toSuccess(baseDataList);
	}

}
